package com.apes.fn.server.servicePlan.repository;

import com.apes.fn.server.servicePlan.model.QualityDetail;
import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.scm.masterdata.party.model.PartyRole;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

/**
 * @program: apes-server
 * @description:
 * @author: czs
 * @create: 2023-04-21 13:48
 **/
public interface QualityDetailRepository extends CustomRepository<QualityDetail, String> {
    List<QualityDetail> findAllByFinishAndLastUpdatedStampBeforeAndErrMsgIsNull(Boolean finish, Date lastUpdatedStamp);

    @Query("select T from QualityDetail T WHERE T.lastUpdatedStamp > :times or (T.id > :id and T.lastUpdatedStamp = :times) order by T.lastUpdatedStamp, T.id asc")
    List<QualityDetail> findByLastUpdatedStampAndId(@Param("times") Date times, @Param("id") String id, Pageable pageable);

}
